import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class FileInputStreamDemo03 {
    public static void main(String[] args) throws IOException {
        FileInputStream fileInputStream = new FileInputStream("C:\\Users\\Administrator\\Desktop\\2.txt");

        byte[] bytes = new byte[10];
//        int l = fileInputStream.read(bytes);
//        System.out.println(l);//10
//        System.out.print(new String(bytes,0,l));

//        int l1 = fileInputStream.read(bytes);
//        System.out.println(l1);
//        System.out.print(new String(bytes,0,l1));

        int len;
        while ((len = fileInputStream.read(bytes)) != -1) {
            System.out.print(new String(bytes,0,len));
        }
        if(fileInputStream != null){
            fileInputStream.close();
        }
    }
}
